$(function() {
	$("#photo").hide();
	$("#editpw").bind("click", function() {
		gotoHtml("/setting/editpw.html");
	});
	$("#editpaypw").bind("click", function() {
		gotoHtml("/setting/editpaypw.html");
	});
	$("#editname").bind("click", function() {
		$.prompt("取个喜欢的名字，<br>做一颗不一样的星星", "", function(text) {
			$.showLoading();
			$.ajax({
				type : "post",
				url : appPath + "/setting/editname.html",
				data : {
					name : text,
					token : $.cookie("token")
				},
				success : function(result) {
					$.hideLoading();
					$.alert(result.msg, function() {
						if (result.code == '1') {
							location.reload();
						} else if (result.code == '-1') {
							window.location = appPath + "/member/login.html";
						}
					});
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					$.hideLoading();
					$.alert("系统异常，请稍后再试");
				}
			});
		}, function() {
			// 点击取消后的回调函数
		});
	});
	$("#editsex").bind("click", function() {
		$.modal({
			title : "只想淡淡的知道你是美女还是帅哥！",
			text : '<input type="radio" id="sex_male" checked="checked" name="sex" value="1" /><label name="sex_male" for="sex_male">男</label>' + '<input type="radio" id="sex_female" name="sex" value="2" /><label name="sex_female" for="sex_female">女</label>' + '<input type="radio" id="sex_nomale" name="sex" value="0" /><label name="sex_nomale" for="sex_nomale">保密</label>',
			buttons : [ {
				text : "取消",
				className : "default",
				onClick : function() {
					$.closeModal();
				}
			}, {
				text : "确定",
				className : "primary",
				onClick : function() {
					var sex = $("input[type='radio']:checked").val();
					if (sex != '') {
						$.showLoading();
						$.ajax({
							type : "post",
							url : appPath + "/setting/editsex.html",
							data : {
								sex : sex,
								token : $.cookie("token")
							},
							success : function(result) {
								$.hideLoading();
								$.alert(result.msg, function() {
									if (result.code == '1') {
										location.reload();
									} else if (result.code == '-1') {
										window.location = appPath + "/member/login.html";
									}
								});
							},
							error : function(XMLHttpRequest, textStatus, errorThrown) {
								$.hideLoading();
								$.alert("系统异常，请稍后再试");
							}
						});
					}
				}
			} ],
		});
	});
})
function choose(type) {
	gotoHtml("/setting/choose.html?type=" + type);
}
function selectfile(){
	$(".webuploader-element-invisible").trigger('click');
}